﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Permission.BLL;

namespace WebSite.admin.roles
{
    public partial class roleedit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id = int.Parse(Request["id"]);
                Roles bll = new Roles();
                Roles.RoleInfo vInfo = bll.GetRoleInfo(id);

                this.RoleEdit_roleid.Value = vInfo.RoleID.ToString();
                this.RoleEdit_rolename.Value = vInfo.RoleName;
                this.RoleEdit_roledescription.Value = vInfo.RoleDescription;
            }
            else
            {
                Roles.RoleInfo info = new Roles.RoleInfo();
                info.RoleID = int.Parse(Request.Form["RoleEdit_roleid"]);
                info.RoleName = Request.Form["RoleEdit_rolename"];
                info.RoleDescription = Request.Form["RoleEdit_roledescription"];

                Roles bll = new Roles();
                bll.UpdateRoleInfo(info);
                Response.End();
            }
        }
    }
}